package sg.bubbles.applet;

import java.awt.Color;
import java.awt.Graphics;

public class Board {
    private final static int FIELD_COUNT = 3;
    private Field[][] fields;
    private int size;
    private final static Color BACK_COLOR = Color.black;
    private double fieldSize;

    public Board(int size) {
	this.size = size;
	fields = new Field[FIELD_COUNT][FIELD_COUNT];
	fieldSize = size / FIELD_COUNT;
	for (int i = 0; i < FIELD_COUNT; i++) {
	    for (int j = 0; j < FIELD_COUNT; j++) {
		fields[i][j] = new Field((int) (fieldSize * i), (int) (fieldSize * j), (int) (fieldSize), (int) (fieldSize));
	    }
	}
    }

    public void paint(Graphics g) {
	g.setColor(BACK_COLOR);
	g.fillRect(0, 0, size, size);
	for (int i = 0; i < FIELD_COUNT; i++) {
	    for (int j = 0; j < FIELD_COUNT; j++) {
		fields[i][j].paint(g);
	    }
	}
    }

}
